//
//  SearchViewController.m
//  PlayDAs
//
//  Created by 周莹 on 15/12/18.
//  Copyright © 2015年 周莹. All rights reserved.
//
#import "PdViewController.h"
#import "EmpViewController.h"
#import "SearchViewController.h"
#import "TSPopoverController.h"
#import "TSActionSheet.h"
#import "FacViewController.h"
#import "UIView+Extension.h"
#import "HMSearchBar.h"
@interface SearchViewController ()<UITableViewDelegate,UITableViewDataSource>

@end

@implementation SearchViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.mainTableView.dataSource = self;
    self.mainTableView.delegate = self;
    self.view.backgroundColor = [UIColor  greenColor];
    HMSearchBar *searchBar = [HMSearchBar searchBar];
    searchBar.width = SCALE_WIDTH(200);
    searchBar.height = SCALE_WIDTH(30);
    searchBar.x = 5;
    searchBar.y = 10;
    [self.view addSubview:searchBar];
    self.buttonPOP = [[UIButton  alloc] initWithFrame:CGRectMake(CGRectGetMaxX(searchBar.frame) +10, 10, SCALE_WIDTH(20), SCALE_WIDTH(30))];
    [self.buttonPOP addTarget:self action:@selector(showActionSheet:forEvent:) forControlEvents:UIControlEventTouchUpInside];
    self.buttonPOP.backgroundColor = [UIColor  yellowColor];
    [self.view  addSubview:self.buttonPOP];
//    UIBarButtonItem * topRightButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(showActionSheet:forEvent:)];
//    topRightButton.title = @"类别";
//    self.navigationItem.rightBarButtonItem = topRightButton;
//    self.navigationController.toolbarHidden = NO;

    // Do any additional setup after loading the view from its nib.
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

-(void) showActionSheet:(id)sender forEvent:(UIEvent*)event
{
    
    
    TSActionSheet *actionSheet = [[TSActionSheet alloc] initWithTitle:@"类别"];
    
    [actionSheet addButtonWithTitle:@"企业信息" block:^{
        EmpViewController  *e = [[EmpViewController  alloc] init];
        [self.navigationController  pushViewController:e  animated:YES];
    }];
    [actionSheet addButtonWithTitle:@"公司信息" block:^{
        FacViewController  *n = [[FacViewController  alloc] init];
        [self.navigationController  pushViewController:n animated:YES];
    }];
    [actionSheet addButtonWithTitle:@"产品信息" block:^{
        PdViewController  *p = [[PdViewController  alloc] init];
        [self.navigationController  pushViewController:p  animated:YES];
    }];    actionSheet.cornerRadius = 5;
    
    [actionSheet showWithTouch:event];
    
    
    
}



-(NSInteger )tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{


    return 100;

}



-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{

static  NSString * cell_id = @"cell";
    UITableViewCell *cell = [tableView  dequeueReusableCellWithIdentifier:cell_id];
    if (cell) {
        cell = [[UITableViewCell  alloc] init];
    }
    return cell;

}


@end
